#ifndef _PERROR_EXIT_H_
# define _PERROR_EXIT_H_

#ifdef DEBUG
#	define MALLOCATE(var,type,size) {fprintf(stderr,"allocating %d bytes\n",size); if(!(var=(type)malloc(size))) perror_exit("%s:%d ",__FILE__,__LINE__);}
#	define REMALLOCATE(var,type,size) if(!(var=(type)realloc(var,size))) perror_exit("%s:%d ",__FILE__,__LINE__);
#
#	define DMESG(fmt,...) fprintf(stderr,"debug: "); fprintf(stderr,fmt,##__VA_ARGS__);
#
#else
#
#	define MALLOCATE(var,type,size) if(!(var=(type)malloc(size))) perror_exit("%s:%d ",__FILE__,__LINE__);
#	define REMALLOCATE(var,type,size) if(!(var=(type)realloc(var,size))) perror_exit("%s:%d ",__FILE__,__LINE__);
#
#	define DMESG(fmt,...)
#
#endif

typedef struct _arg_wrapper {
	void *arg1; void *arg2; void *arg3;
	void *arg4; void *arg5; void *arg6;
	void *arg7; void *arg8; void *arg9;
} arg_wrapper;

void perror_exit(char *fmt, ...);
char *concatenate(char *str1, const char *str2);

#endif
